package demo.storage;

import java.io.Serializable;

/**
 * Raft日志条目类
 */
public class LogEntry implements Serializable {
    private final int index;      // 日志索引
    private final int term;       // 任期号
    private final String command; // 命令内容
    
    public LogEntry(int index, int term, String command) {
        this.index = index;
        this.term = term;
        this.command = command;
    }
    
    public int getIndex() {
        return index;
    }
    
    public int getTerm() {
        return term;
    }
    
    public String getCommand() {
        return command;
    }
    
    @Override
    public String toString() {
        return String.format("LogEntry{index=%d, term=%d, command='%s'}", index, term, command);
    }
}